home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD-ROM Magazine 28 Bonus
/
CDRomMagazine-SoftKey-ArtPassion-FrenchVersion-Win31Mac.bin
/
data
/
ltcrepl.dir
/
00085_Script_moving the shadow
< prev
next >
Wrap
Text File
|
1996-05-01
|
3KB
|
110 lines
-- ---------------------------------------------------------------
-- Handler moveShadow
on moveShadow whichSprite
-- when mouseDown then shadowDrag
end
-- ---------------------------------------------------------------
-- Handler shadowDrag
on shadowDrag
global shadow
-- if they clicked on the shadow (checked by the sprite number of the clickOn)
if (the clickOn = shadow) then TrackAndCheck (shadow, "RS")
end
-- ---------------------------------------------------------------
-- Handler trackAndCheck
on trackAndCheck ClickedSprite, NewName,
global gameOver
-- drag the mosaic while the mouse is down
repeat while the stillDown
SpriteFollowMouse( ClickedSprite)
if gameOver then exit
end repeat
-- the mouse is now Up, ie. the user placed the shadow somewhere
-- check if the shadow was placed in the right place
if shadowInPlace() then
doMatch ()
end if
-- else
-- doReturn (ClickedSprite, storeH, storeV)
-- end if
end
-- ---------------------------------------------------------------
-- Handler spriteFollowMouse
on spriteFollowMouse whichSprite
-- move the shadow with the mouse
set the locH of sprite whichSprite = the mouseH
set the locV of sprite whichSprite = the mouseV
updateStage
end
-- ---------------------------------------------------------------
-- Handler shadowInPlace returns true if the user placed the shadow
-- in its proper place and false otherwise.
on shadowInPlace
global shadow, shadowH, shadowV,
return ((abs(the locH of sprite shadow - shadowH) <= 10) and (abs(the locV of sprite shadow - shadowV) <= 10))
end
-- ---------------------------------------------------------------
-- Handler doMatch
on doMatch
global shadowH, shadowV, currentPlacedShadow, shadow
-- place the mosaic on the board
changeSpriteCastNumber
set the castNum of sprite currentPlacedShadow = the castNum of sprite shadow
set the locH of sprite currentPlacedShadow = shadowH
set the locV of sprite currentPlacedShadow = shadowV
removeFromStage(shadow)
puppetSound "correct"
updateStage
waitTicksInterruptable 180
updateCurrentPlacedShadow
updatePlacedShadowsList
end
-- ---------------------------------------------------------------
-- Handler doReturn
on doReturn ClickedSprite, storeH, storeV
puppetsound "Missed"
-- return the sprite to its original location
set the locH of sprite ClickedSprite to storeH
set the locV of sprite ClickedSprite to storeV
end
on changeSpriteCastNumber
global shadow,tag
puppetSprite shadow, TRUE
set CastNumber = the castNum of sprite shadow
set CastName = the name of cast CastNumber
if tag = 0 then
set NewName = CastName && "PLACED"
else
set NewName = CastName && "PLACED1"
end if
set the castNum of sprite the clickOn = cast NewName
updateStage
end